package cn.cjlmonster.demo02.ui;

import com.chad.library.adapter.base.entity.MultiItemEntity;

import cn.cjlmonster.demo02.R;
import cn.cjlmonster.demo02.base.BaseAppCompatActivity;
import cn.cjlmonster.demo02.virtual.DF;
import cn.cjlmonster.demo02.widget.RandomText;

/**
 * cn.cjlmonster.demo02.ui
 *
 * @author cjl
 * @project Demo02
 * @date 2022/11/4 23:31
 */
public class DeviceActivity extends BaseAppCompatActivity {

    @Override
    protected int getLayoutId() {
        return R.layout.activity_device;
    }

    @Override
    protected boolean canBack() {
        return true;
    }

    private RandomText randomText;

    @Override
    protected void initView() {
        randomText = findViewById(R.id.randomText);
    }

    @Override
    protected void initData() {
        int index = getIntent().getIntExtra("index", -1);
        if (index == -1) {
            finish();
            return;
        }
        MultiItemEntity device = DF.deviceList.get(index);
        randomText.setDevice(this, device);
    }
}
